package com.jgp.glmeeting.mobile.controller;

import com.jgp.glmeeting.mobile.commons.BaseResponse;
import com.jgp.glmeeting.mobile.commons.ErrorMsg;
import com.jgp.glmeeting.model.Manager;
import com.jgp.glmeeting.model.Participants;
import com.jgp.glmeeting.service.ManagerService;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/mobile/MobileManagerController")
public class MobileManagerController {
    private final Logger logger = LoggerFactory.getLogger(MobileManagerController.class);

    @Autowired
    private ManagerService managerService;

    @RequestMapping("queryById")
    public BaseResponse queryById(String managerId) {
        if(StringUtils.isBlank(managerId)) {
            return new BaseResponse(ErrorMsg.INVALID_PARAM.getCode(), ErrorMsg.INVALID_PARAM.getErrorMsg());
        }
        try {
            Manager manager= managerService.queryID(managerId);
            BaseResponse baseResponse = new BaseResponse(200);
            baseResponse.setObj(manager);
            return baseResponse;
        }catch (Exception e){
            logger.error("查找人员接口异常, 参数 participantsId={}",e, managerId);
            return new BaseResponse(ErrorMsg.SERVER_ERROR.getCode(), ErrorMsg.SERVER_ERROR.getErrorMsg());
        }
    }

}
